{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 程序log输出如下"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "\n",
    "# 逻辑与数据\n",
    "samples_and = [\n",
    "    [0,0,0],\n",
    "    [1,0,0],\n",
    "    [0,1,0],\n",
    "    [1,1,1]\n",
    "]\n",
    "\n",
    "\n",
    "# 逻辑或数据\n",
    "samples_or = [\n",
    "    [0,0,0],\n",
    "    [1,0,1],\n",
    "    [0,1,1],\n",
    "    [1,1,1]\n",
    "]\n",
    "\n",
    "\n",
    "# 逻辑异或数据\n",
    "samples_xor = [\n",
    "    [0,0,0],\n",
    "    [1,0,1],\n",
    "    [0,1,1],\n",
    "    [1,1,0]\n",
    "]\n",
    "\n",
    "\n",
    "def perceptron(samples):\n",
    "    w = np.array([1, 2])\n",
    "    b = 0\n",
    "    a = 1\n",
    "\n",
    "    for i in range(10):\n",
    "        for j in range(4):\n",
    "            x = np.array(samples[j][:2])\n",
    "            y = 1 if np.dot(w, x) + b > 0 else 0\n",
    "            d = np.array(samples[j][2])\n",
    "\n",
    "            delta_b = a*(d-y)\n",
    "            delta_w = a*(d-y)*x\n",
    "\n",
    "            print('epoch {} sample {}  [{} {} {} {} {} {} {}]'.format(\n",
    "                i, j, w[0], w[1], b, y, delta_w[0], delta_w[1], delta_b\n",
    "            ))\n",
    "\n",
    "            w = w + delta_w\n",
    "            b = b + delta_b\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "logical and\n",
      "epoch 0 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 0 sample 1  [1 2 0 1 -1 0 -1]\n",
      "epoch 0 sample 2  [0 2 -1 1 0 -1 -1]\n",
      "epoch 0 sample 3  [0 1 -2 0 1 1 1]\n",
      "epoch 1 sample 0  [1 2 -1 0 0 0 0]\n",
      "epoch 1 sample 1  [1 2 -1 0 0 0 0]\n",
      "epoch 1 sample 2  [1 2 -1 1 0 -1 -1]\n",
      "epoch 1 sample 3  [1 1 -2 0 1 1 1]\n",
      "epoch 2 sample 0  [2 2 -1 0 0 0 0]\n",
      "epoch 2 sample 1  [2 2 -1 1 -1 0 -1]\n",
      "epoch 2 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 2 sample 3  [1 2 -2 1 0 0 0]\n",
      "epoch 3 sample 0  [1 2 -2 0 0 0 0]\n",
      "epoch 3 sample 1  [1 2 -2 0 0 0 0]\n",
      "epoch 3 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 3 sample 3  [1 2 -2 1 0 0 0]\n",
      "epoch 4 sample 0  [1 2 -2 0 0 0 0]\n",
      "epoch 4 sample 1  [1 2 -2 0 0 0 0]\n",
      "epoch 4 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 4 sample 3  [1 2 -2 1 0 0 0]\n",
      "epoch 5 sample 0  [1 2 -2 0 0 0 0]\n",
      "epoch 5 sample 1  [1 2 -2 0 0 0 0]\n",
      "epoch 5 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 5 sample 3  [1 2 -2 1 0 0 0]\n",
      "epoch 6 sample 0  [1 2 -2 0 0 0 0]\n",
      "epoch 6 sample 1  [1 2 -2 0 0 0 0]\n",
      "epoch 6 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 6 sample 3  [1 2 -2 1 0 0 0]\n",
      "epoch 7 sample 0  [1 2 -2 0 0 0 0]\n",
      "epoch 7 sample 1  [1 2 -2 0 0 0 0]\n",
      "epoch 7 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 7 sample 3  [1 2 -2 1 0 0 0]\n",
      "epoch 8 sample 0  [1 2 -2 0 0 0 0]\n",
      "epoch 8 sample 1  [1 2 -2 0 0 0 0]\n",
      "epoch 8 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 8 sample 3  [1 2 -2 1 0 0 0]\n",
      "epoch 9 sample 0  [1 2 -2 0 0 0 0]\n",
      "epoch 9 sample 1  [1 2 -2 0 0 0 0]\n",
      "epoch 9 sample 2  [1 2 -2 0 0 0 0]\n",
      "epoch 9 sample 3  [1 2 -2 1 0 0 0]\n"
     ]
    }
   ],
   "source": [
    "print('logical and')\n",
    "perceptron(samples_and)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "logical or\n",
      "epoch 0 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 0 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 0 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 0 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 1 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 1 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 1 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 1 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 2 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 2 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 2 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 2 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 3 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 3 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 3 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 3 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 4 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 4 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 4 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 4 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 5 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 5 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 5 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 5 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 6 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 6 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 6 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 6 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 7 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 7 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 7 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 7 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 8 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 8 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 8 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 8 sample 3  [1 2 0 1 0 0 0]\n",
      "epoch 9 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 9 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 9 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 9 sample 3  [1 2 0 1 0 0 0]\n"
     ]
    }
   ],
   "source": [
    "print('logical or')\n",
    "perceptron(samples_or)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "logical xor\n",
      "epoch 0 sample 0  [1 2 0 0 0 0 0]\n",
      "epoch 0 sample 1  [1 2 0 1 0 0 0]\n",
      "epoch 0 sample 2  [1 2 0 1 0 0 0]\n",
      "epoch 0 sample 3  [1 2 0 1 -1 -1 -1]\n",
      "epoch 1 sample 0  [0 1 -1 0 0 0 0]\n",
      "epoch 1 sample 1  [0 1 -1 0 1 0 1]\n",
      "epoch 1 sample 2  [1 1 0 1 0 0 0]\n",
      "epoch 1 sample 3  [1 1 0 1 -1 -1 -1]\n",
      "epoch 2 sample 0  [0 0 -1 0 0 0 0]\n",
      "epoch 2 sample 1  [0 0 -1 0 1 0 1]\n",
      "epoch 2 sample 2  [1 0 0 0 0 1 1]\n",
      "epoch 2 sample 3  [1 1 1 1 -1 -1 -1]\n",
      "epoch 3 sample 0  [0 0 0 0 0 0 0]\n",
      "epoch 3 sample 1  [0 0 0 0 1 0 1]\n",
      "epoch 3 sample 2  [1 0 1 1 0 0 0]\n",
      "epoch 3 sample 3  [1 0 1 1 -1 -1 -1]\n",
      "epoch 4 sample 0  [0 -1 0 0 0 0 0]\n",
      "epoch 4 sample 1  [0 -1 0 0 1 0 1]\n",
      "epoch 4 sample 2  [1 -1 1 0 0 1 1]\n",
      "epoch 4 sample 3  [1 0 2 1 -1 -1 -1]\n",
      "epoch 5 sample 0  [0 -1 1 1 0 0 -1]\n",
      "epoch 5 sample 1  [0 -1 0 0 1 0 1]\n",
      "epoch 5 sample 2  [1 -1 1 0 0 1 1]\n",
      "epoch 5 sample 3  [1 0 2 1 -1 -1 -1]\n",
      "epoch 6 sample 0  [0 -1 1 1 0 0 -1]\n",
      "epoch 6 sample 1  [0 -1 0 0 1 0 1]\n",
      "epoch 6 sample 2  [1 -1 1 0 0 1 1]\n",
      "epoch 6 sample 3  [1 0 2 1 -1 -1 -1]\n",
      "epoch 7 sample 0  [0 -1 1 1 0 0 -1]\n",
      "epoch 7 sample 1  [0 -1 0 0 1 0 1]\n",
      "epoch 7 sample 2  [1 -1 1 0 0 1 1]\n",
      "epoch 7 sample 3  [1 0 2 1 -1 -1 -1]\n",
      "epoch 8 sample 0  [0 -1 1 1 0 0 -1]\n",
      "epoch 8 sample 1  [0 -1 0 0 1 0 1]\n",
      "epoch 8 sample 2  [1 -1 1 0 0 1 1]\n",
      "epoch 8 sample 3  [1 0 2 1 -1 -1 -1]\n",
      "epoch 9 sample 0  [0 -1 1 1 0 0 -1]\n",
      "epoch 9 sample 1  [0 -1 0 0 1 0 1]\n",
      "epoch 9 sample 2  [1 -1 1 0 0 1 1]\n",
      "epoch 9 sample 3  [1 0 2 1 -1 -1 -1]\n"
     ]
    }
   ],
   "source": [
    "print('logical xor')\n",
    "perceptron(samples_xor)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 解释为什么这⾥的感知器代码⽆法完成异或功能"
   ]
  },
  {
   "attachments": {
    "%E5%9B%BE%E7%89%87.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAFvCAYAAAC2K5dYAAAYvElEQVR4nO3de3CU9b3H8SdcRCJSpzO9/HE6Ikc6HdvqSDva0s50eo4zrczpaWlntLUjg1okotFAgCAY5SYVLBfFIucgFzOpwInKpVBsSgIEghLwghl6gGAIISEkuLltkr09+/ucPyA5Vrl8ocjuZt+vme/f/J55ss97d3/7PHgCAMDIS/QCAACpg2gAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDAjGgAAMyIBgDA7KpEIx6PKxqNKhKJKBaLMQzDMOeZ7mtlJBKRc+5qXKIvyeceDeecWlpatG3bNr3++uvasGGDNm5MrdmwYX1Krpth0nnOvG7XJ3wdl77uDSoqKtLOnTvU1taWdOH43KMRj8d19OhRPfbYY8rJydELixfrpZdeSpl58cUXNXnyZE2bNk0vvPBCwtfDMMzFZ/HixcrLy1NeXp6WLFmS8PVc0toXLdJjjz2myZMnq7a2Nv2i4ZzTsWPHlJubqzfeeENtbW0KdXWlzATb2/XXv/5Vu3btUnt7e8LXwzDMxaelpUUlJSUqKSlRV2dnwtdzKdPc3KzXXntNeXl5qqurS89o1NTUaPLkydq8ebOi0ejn/U9eUbFYTDt27FBFRUXKrR1IV6FQSLt371Z5eXnSXXQvJhQK6fXXX9fUqVNVX1+fdOsnGhfh+7727dunyspKxWKxRC8HgEEkEtH777+nDz74IOkuuhdDNFI8Gs45BYNBdXZ2Jt3JA3Buzjl1dHSoo6Mj5V63RCPFowEAVxPRIBoAYEY0iAYAmBENogEAZkSD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v15IlS/Tkk09qxowZmjlzZsrMjBkzlJ+fr/z8/JRbO8Ok63zydZvotVzO2p988kktX75cjY2N6RcN55yi0agaGxt18uRJnTp1imEYhrnA1NfXq6mpSbFYLP2i0c05l5ITj8cVjUZ7fnYbj8cTviaGYS48sVisZ48glV+zyeiqRSMV+b6v2tpabdmyRQUFBVq/fr2qq6v56S2QpJxz6uzsVGlpqVavXq1XX31VtbW1SXsBTkVE4zyccwoEPtayZcv06KOPavr06crOztYfnn9eJ0+eTPTyAJyDc05NTU2aPXu27r33Xt19990qKysjGlcQ0TiPeDyusrIyZWVlaePGjWpqatLOnTs1duxYbdy4UbFYLNFLBPApzjlFIhHV1NSouLhY48eP186dO4nGFUQ0ziMWi+lPf/qTssaN06FDh+ScU319vfLz87Vw4UK1trYmeokAziMej+uDDz7QhAkTiMYVRjTOIxaLadWqVRo/frw++ugjSdLp06c1d+5czZkzR4HAxwleIYDzIRqfH6JxHrFYTAUFBXokK0tVVVWSpFOnTmnmzJmaP3++mpubE7xCAOdDND4/ROM8fN/XW2+9pbFjx6qsrEyRSESVlZXKysrSa6+9pkgkkuglAjgH587cG/beu+/qiSee0Pbt2+X7PuG4QojGeTjnVFdXpxkzZignJ0fLly/X1KlTNXHixJR8ciaQLsLhsIqLizV37lyNHDlS+fn52rVrFw8cvUKIxgXEYjF9+OGHWrhwoSZMyNHcuXP13nvv8scHJLGOjg4tWrRIDz74oO6991498MADWrlypTo7OxO9tF6BaFyE7/vq6OhQc3Oz2tvbubEPSHLxeFxtbW0KBAI9EwwG+XbgCiEaAAAzogEAMCMaAAAzogEAMCMaAAAzogEAMCMaAAAzogEAMCMaAAAzogEAMCMaAAAzogEAMCMaAAAzogEAMCMaAAAzogEAMPs/5QlppAY+10wAAAAASUVORK5CYII="
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对于上述感知器，仅能处理线性分类问题，对于像异或这样的非线性问题无法处理。\n",
    "![%E5%9B%BE%E7%89%87.png](attachment:%E5%9B%BE%E7%89%87.png)\n",
    "如图所示，我们无法通过一条直线将红色圆和黑色矩形区分开来，所以这样的w是无法求得的，故上述程序代码无法完成异或功能。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
